#include <stdio.h>

int main()
{
    int c;

    int ns = 0;

    while ((c = getchar()) != EOF)
    {
        if (c == ' ')
        {
            ++ns;
            continue;
        }

        if (ns > 0)
        {
            printf(" ");
            putchar(c);
            ns = 0;
            continue;
        }

        putchar(c);
    }

    return 0;
}